package com.chat.video.service.impl;

import cn.hutool.core.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chat.entity.UserEntity;
import com.chat.video.mapper.UserMapper;
import com.chat.video.service.UserService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 用户信息 服务实现类
 * </p>
 *
 * @author zl
 * @since 2020-08-04
 */
@Service
public class UserSerivceImp implements UserService {

    @Autowired
    private UserMapper userMapper ;

    @Override
    public List<UserEntity> listAll() {
        List<UserEntity> list=userMapper.listAll();
        List<UserEntity> rlist = list.stream()
                                      .filter(s -> s.getUsername().equals("admin"))
                                      .collect(Collectors.toList());
        return rlist;
    }

    @Override
    public IPage<UserEntity> list(int pageSize, int pageLimit) {
        Page<UserEntity> page =new Page(pageSize,pageLimit);
        IPage<UserEntity> Ilist=userMapper.list(page);

        return Ilist;
    }

    @Override
    public UserEntity info(String id) {
        return null;
    }

    @Override
    public void update(UserEntity userEntity) {

    }

    @Override
    public void save(UserEntity userEntity) {

    }

    @Override
    public void delete(String[] ids) {

    }
}
